In this we are going to see a basic example of multilevel inner class in Python Programming Language.
class Multi:
def __init__(self):
self.inner = self.Inner()
self.innerinner = self.inner.InnerInside()
def show(self):
print("This is the Outer class")
class Inner:
def __init__(self):
self.innerinner = self.InnerInside()
def show_classes(self):
print("This is the Inner class")
print(self.innerinner)
class InnerInside:
def inner_display(self, msg):
print("Inner of Inside class")
print(msg)
def inner_display(self, msg):
print("This is the Inner class")
print(msg)
m = Multi()
m.show()
inner = Multi.Inner()
inner.show_classes()
innerinner = inner.InnerInside()
innerinner.inner_display("completed")
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP